//
//  BusinessViewController.m
//  WGFGlobalHouse
//
//  Created by waiguofang on 15/4/15.
//  Copyright (c) 2015年 waiguofang. All rights reserved.
//  交易管理--我的订单

#import "BusinessViewController.h"
#import "OrderDetailViewController.h"
#import "TraderOrderCell.h"

#define LABWIDTH UIScreenWidth/3.0


@interface BusinessViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
- (IBAction)clickBtn:(UIButton *)sender;
@property (weak, nonatomic) IBOutlet UIButton *fristBtn;
@property (weak, nonatomic) IBOutlet UILabel *lab;

//保存选中的按钮
@property (strong, nonatomic) UIButton *seletedBtn;
@end

@implementation BusinessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.titleView setMianTitle:@"我的订单"];
//    [self.labView setBackgroundColor:[UIColor colorWithWhite:0 alpha:0.33]];
    self.tableView.rowHeight = 175;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    [self clickBtn:self.fristBtn];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
    return 3;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
    return [TraderOrderCell cellWithTableView:tableView];
    
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    
    OrderDetailViewController *orderDetailVC = [[OrderDetailViewController alloc]initWithNibName:@"OrderDetailViewController" bundle:nil];
    orderDetailVC.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:orderDetailVC animated:YES];
}

- (IBAction)clickBtn:(UIButton *)sender {
    
    self.seletedBtn.selected = NO;
    sender.selected = YES;
    self.seletedBtn = sender;
    
//    self.lab.highlighted = YES;
    self.lab.frame = CGRectMake((sender.tag-100) * LABWIDTH, 33, LABWIDTH, 2);
}
@end
